# use third libs
include(FetchContent)

# sqlite_orm
message("Downlaod sqlite_orm from https://gitee.com/bt-server/sqlite_orm.git")
FetchContent_Declare(
  sqlite_orm
  GIT_REPOSITORY https://gitee.com/bt-server/sqlite_orm.git
  # GIT_TAG v1.7.1
  SOURCE_DIR ${THIRD_PARTY_LIBS}/sqlite_orm
  GIT_SHALLOW    TRUE # 不拉取完整历史，相当于`git clone --depth=1`
  )

FetchContent_GetProperties(sqlite_orm)
if (NOT sqlite_orm_POPULATED)
  FetchContent_Populate(sqlite_orm)
endif ()

macro(use_sqlite_orm ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_SQLITE_ORM)
  # include sqlite_orm_SOURCE_DIR ==> third/sqlite_orm
  target_include_directories(${ag_project_name} PRIVATE ${sqlite_orm_SOURCE_DIR}/include)
endmacro(use_sqlite_orm)